<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>辣妈优选</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style media="screen">
        #app {
            width: 100%;
            height: 210px;
            background: url(../../image/hot_mam_bg.png) no-repeat;
            background-size: 100% 154px;
        }

        header {
            width: 100%;
            height: 44px;
        }

        .title {
            width: 100%;
            padding: 0 140px;
            text-align: center;
            white-space: nowrap;
            line-height: 44px;
            overflow: hidden;
            text-overflow: ellipsis;
            z-index: 2;
            color: #fff;
            font-size: 17px;
        }

        .title img {
            display: inline-block;
            width: 23px;
            height: 19px;
            margin-top: 12.5px;
        }

        header span {
            display: block;
            width: 44px;
            height: 44px;
            background: url(../../image/white_back.png) no-repeat;
            background-size: 22px 22px;
            background-position: center;
            position: absolute;
        }

        .index_bg {
            width: 100%;
            height: 102px;
            /*margin-top: 15px;*/
            padding: 0 15px;
        }

        .index_bg img {
            width: 100%;
            height: 100%;
            display: block;
        }
        /*.index_bg::after{
          content: '';
          width: 120%;
          height: 100px;
          position: absolute;
          left: -10%;
          top: 0;
          border-radius: 0 0 50% 50%;
          background: linear-gradient(266deg, #7D0DFC, #D116FD);
        }*/

        .nav {
            width: 100%;
            padding: 0 15px;
            margin-top: 15px;
            display: flex;
            justify-content: space-between;
            position: relative;
            box-sizing: border-box;
            overflow: hidden;
        }

        .nav .nav-menu {
            width: auto;
            font-size: 14px;
            color: #FFFFFF;
            letter-spacing: 0;
            /*text-align: center;*/
            /*padding-right: 22.5px;*/
            /* padding-top: 10px; */
        }

        .nav .nav-menu span {
            /*width: auto;*/
            display: block;
        }

        .nav .nav-menu span:first-child {
            /*width: 60px;*/
            height: 17px;
            line-height: 17px;
            color: #333333;
            /*border: 1px solid yellow;*/
        }

        .nav .nav-menu span.selected {
            font-size: 16px;
            height: 17px;
            /*font-weight: bold;*/
            line-height: 17px;
            /*background: linear-gradient(266deg, #BF14FD, #7D0DFC);*/
            /*border-radius: 10px;*/
            /*padding: 0 8px;*/
        }

        .nav .nav-menu span.selected_line {
            width: 100%;
            height: 2px;
            background: #333;
            margin: 0 auto;
            margin-top: 2px;
            border-radius:1px;
        }
        [v-cloak] {
            display: none!important;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <header id="header">
            <span tapmode @click="closeWin()"></span>
            <div class="title">辣妈优选</div>
        </header>
        <div class="index_bg"><img src="../../image/hotmam_banner.png" alt=""></div>
        <div class="nav">
            <div class="nav-menu" v-for='(item,index) in navlist'>
                <span :class="{'selected':isActive==index}" tapmode @click="change(index,item.id)">{{item.name}}</span>
                <span :class="{'selected_line':isActive==index}"></span>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/cling.js"></script>
<script type="text/javascript">
    apiready = function() {
        var header = $api.byId('app');
        var headerH = $api.fixStatusBar(header);
        api.openFrame({
            name: 'hot_mam_frame',
            url: './hot_mam_frame.html',
            rect: {
                marginTop: headerH,
                marginBottom: api.safeArea.bottom, // main页面距离win底部的高度
                w: 'auto'
            },
            bounces: true,
            bgColor: '#FAF9F9',
            vScrollBarEnabled: true,
            hScrollBarEnabled: true
        });

    }
    var vm = new Vue({
        el: '#app',
        data: {
            isActive: 0,
            navlist: [{
                'name': '备孕',
                'id': '4040'
            }, {
                'name': '0-6个月',
                'id': '4041'
            }, {
                'name': '7-12个月',
                'id': '4042'
            }, {
                'name': '1-3岁',
                'id': '4043'
            }, {
                'name': '4-6岁',
                'id': '4044'
            }, {
                'name': '7-12岁',
                'id': '4045'
            }]
        },
        methods: {
            change: function(index,id) {
                vm.isActive = index;
                var jsfun1 = 'vm.clearData()';
                api.execScript({
                    frameName: 'hot_mam_frame',
                    script: jsfun1
                });
                var jsfun = 'vm.init("' + id + '");';
                api.execScript({
                    frameName: 'hot_mam_frame',
                    script: jsfun
                });

            },
            closeWin: function() {
                cl.closeWin({
                    name: 'hot_mam'
                })
            }
        }
    });
</script>

</html>
